import {
  getHeaderCarousel,
  getDailyCollectionCarousel,
  getGoodTv,
  getListBottom,
  getListTop,
} from "../../utils/api";
const loudVoice = {
  state() {
    return {
      // 头部轮播图
      getHeaderCarousel: "",
      // 每日珍藏卡片轮播图
      getDailyCollectionCarousel: "",
      // 好剧推荐
      getGoodTv: "",
      // 纵向排列商品
      getListBottom: "",
      // 横向排列商品
      getListTop: "",
    };
  },
  mutations: {
    // 头部轮播图
    getHeaderCarousel(state, payload) {
      state.getHeaderCarousel = payload;
    },
    // 每日珍藏卡片轮播图
    getDailyCollectionCarousel(state, payload) {
      state.getDailyCollectionCarousel = payload;
    },
    // 好剧推荐
    getGoodTv(state, payload) {
      state.getGoodTv = payload;
    },
    // 纵向排列商品
    getListBottom(state, payload) {
      state.getListBottom = payload;
    },
    // 横向排列商品
    getListTop(state, payload) {
      state.getListTop = payload;
    },
  },
  actions: {
    // 头部轮播图
    async getHeaderCarousel({ commit }) {
      const res = await getHeaderCarousel();
      commit("getHeaderCarousel", res);
    },
    // 每日珍藏卡片轮播图
    async getDailyCollectionCarousel({ commit }) {
      const res = await getDailyCollectionCarousel();
      commit("getDailyCollectionCarousel", res);
    },
    // 好剧推荐
    async getGoodTv({ commit }) {
      const res = await getGoodTv();
      commit("getGoodTv", res);
    },
    // 纵向排列商品
    async getListBottom({ commit }) {
      const res = await getListBottom();
      commit("getListBottom", res);
    },
    // 横向排列商品
    async getListTop({ commit }) {
      const res = await getListTop();
      commit("getListTop", res);
    },
  },
};
export default loudVoice;
